From: Georges Basile Stavracas Neto Date: Tue, 31 Jan 2023 17:38:39 +0000 (-0300) Subject: status/powerProfiles: Set profile name as subtitle X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~405^2^2~90 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=ec397cf604865733ee34b61c21caba04278da697;p=gnome-shell.git status/powerProfiles: Set profile name as subtitle Just like with network names, set the name of the power profile as the subtitle of the quick settings pill. This allows more of the power profile name to be visible, and reduces chances of ellipsing the name. Rename the 'title' variable to 'name', to be more semantic and better represent what it is now. Related: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/5770 Part-of: --- diff --git a/js/ui/status/powerProfiles.js b/js/ui/status/powerProfiles.js index eed245571..1a394bca2 100644 --- a/js/ui/status/powerProfiles.js +++ b/js/ui/status/powerProfiles.js @@ -17,17 +17,17 @@ const PowerProfilesProxy = Gio.DBusProxy.makeProxyWrapper(PowerProfilesIface); const PROFILE_PARAMS = { 'performance': { - title: C_('Power profile', 'Performance'), + name: C_('Power profile', 'Performance'), iconName: 'power-profile-performance-symbolic', }, 'balanced': { - title: C_('Power profile', 'Balanced'), + name: C_('Power profile', 'Balanced'), iconName: 'power-profile-balanced-symbolic', }, 'power-saver': { - title: C_('Power profile', 'Power Saver'), + name: C_('Power profile', 'Power Saver'), iconName: 'power-profile-power-saver-symbolic', }, }; @@ -37,7 +37,7 @@ const LAST_PROFILE_KEY = 'last-selected-power-profile'; const PowerProfilesToggle = GObject.registerClass( class PowerProfilesToggle extends QuickMenuToggle { _init() { - super._init(); + super._init({title: _('Power Mode')}); this._profileItems = new Map(); @@ -83,11 +83,11 @@ class PowerProfilesToggle extends QuickMenuToggle { .map(p => p.Profile.unpack()) .reverse(); for (const profile of profiles) { - const {title, iconName} = PROFILE_PARAMS[profile]; - if (!title) + const {name, iconName} = PROFILE_PARAMS[profile]; + if (!name) continue; - const item = new PopupMenu.PopupImageMenuItem(title, iconName); + const item = new PopupMenu.PopupImageMenuItem(name, iconName); item.connect('activate', () => (this._proxy.ActiveProfile = profile)); this._profileItems.set(profile, item); @@ -111,7 +111,9 @@ class PowerProfilesToggle extends QuickMenuToggle { : PopupMenu.Ornament.NONE); } - this.set(PROFILE_PARAMS[activeProfile]); + const {name: subtitle, iconName} = PROFILE_PARAMS[activeProfile]; + this.set({subtitle, iconName}); + this.checked = activeProfile !== 'balanced'; if (this.checked)